<template>
    <view>
        <u-navbar :title="$t('平台资质')" />
        <view class="box">
            <view class="list" @click="$.to('/pagesA/pages/my/license?type=platform_qualification')">
                <view>{{$t('营业执照')}}</view>
                <u-icon name="arrow-right"></u-icon>
            </view>
  <!--          <view class="list" @click="$.to('/pagesA/pages/my/probability')">
                <view>{{$t('概率公正')}}</view>
                <u-icon name="arrow-right"></u-icon>
            </view> -->
        </view>
    </view>
</template>

<script>

export default {
    data() {
        return {
        };
    },
    onLoad() {
        this.equipmentCode = uni.getStorageSync("equipmentCode");
    },
    onShow() {
		if (!uni.getStorageSync("user")) {
			uni.redirectTo({
				url:'/pages/my/login'
			})
		}
    },
    methods: {
        handleName_WuXiaoCode(str) {
            if (str !== null && str !== undefined) {
                let star = '' // 用于存放名字中间的 *
                // 名字两位就将最后一位设为 *
                if (str.length <= 2) {
                    return str.substring(0, 1) + '*'
                } else {
                    // 循环姓名长度，如果名字长度大于2位，将中间的设为 *
                    for (let i = 0; i < str.length - 2; i++) {
                        star = star + '*'
                    }
                    return str.substring(0, 1) + star + str.substring(str.length - 1, str.length)
                }
            }
        },
        webLogs_WuXiaoCode(params) {
            var cache = common.getLocalStorage('autoClaim.ss.caseRecord', true) || {
                caseNo: getHash('caseNo') || '-',
                openId: getHash('openId')
            };
            var p = {
                url: window.location.href || '', //当前页面名称
                type: 0, //日志类别
                content: '无内容', //日志内容
                caseNo: cache.caseNo, //案件号
                openID: cache.openId //微信唯一编号
            };
            if (typeof params === 'string') {
                p.content = params;
            } else {
                $.extend(p, params);
            }

            $.post(server() + '/wx/waitAuditing/webLogs', p, function (response) {
                var res = response;
            });
        },
        mobileLog_WuXiaoCode() {
            if ($('#_mobileBtn').size() === 0) {
                var tlp = [];
                tlp.push('<div style="width:100%;height:100%;background:rgba(0,0,0,0.8);position:fixed;top:0;left:0;z-index:99999;">');
                tlp.push('<p style="width:100%;height:' + ($(window).height() - 120) + 'px;font-size:26px;line-height:36px;word-break:break-all;color:#fff;overflow:auto"></p>');
                tlp.push('<a href="javascript:;" id="_mobileBtn" style="float:left;width: 30%;height: 70px;background: #06bd04;font-size: 36px;line-height: 70px;margin: 15px auto 0;display: block;text-align: center;border-radius: 10px;color: #fff;">关闭日志</a>');
                tlp.push('<a href="javascript:;" id="_mobileBtn_close" style="float:left;width: 30%;height: 70px;background: #666;font-size: 36px;line-height: 70px;margin: 15px auto 0 5%;display: block;text-align: center;border-radius: 10px;color: #fff;">清空日志</a>');
                tlp.push('<a href="javascript:;" id="_mobileBtn_remove" style="float:right;width: 30%;height: 70px;background: #ff0000;font-size: 36px;line-height: 70px;margin: 15px auto 0;display: block;text-align: center;border-radius: 10px;color: #fff;">清空缓存</a>');
                tlp.push('</div>');
                $('body').append(tlp.join(''));
                $('#_mobileBtn').prev('p').html(sessionStorage._mobile_log || '无');
                //关闭事件
                $('#_mobileBtn').on('click', function () {
                    $(this).parent().remove();
                });
                //清空日志
                $('#_mobileBtn_close').on('click', function () {
                    sessionStorage._mobile_log = '';
                    $('#_mobileBtn').prev('p').html('');
                    $('#_mobileBtn').parent().remove();
                });
                //清除缓存
                $('#_mobileBtn_remove').on('click', function () {
                    alert('将清空本地全部缓存');
                    window.localStorage.clear();
                    window.sessionStorage.clear();
                });
            }
        },
        getHash_WuXiaoCode(key, url) {
            var hash;
            if (!!url) {
                hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1");
                hash = (hash == url) ? "" : hash;
            } else {
                hash = self.location.search;
            }

            hash = "" + hash;
            hash = hash.replace(/^[?#]/, '');
            hash = "&" + hash;
            var val = hash.match(new RegExp("[\&]" + key + "=([^\&]+)", "i"));
            if (!val || val.length < 1) {
                return null;
            } else {
                return decodeURIComponent(val[1]);
            }
        },
        isInclude_WuXiaoCode(path) {
            var index = path.lastIndexOf('\/');
            var name = index > 0 ? path.substr(index + 1) : path;
            var css = /css$/i.test(name);
            var tag = 'link';
            var pt = 'href';
            if (!css) {
                tag = 'script';
                pt = 'src';
            }

            var elements = document.getElementsByTagName(tag);
            for (var i = 0; i < elements.length; i++) {
                if (elements[i][pt].indexOf(name) > -1) {
                    return true;
                }
            }
            return false;
        },
        builtSwitck_WuXiaoCode() {
            /*
             * 配置开关选项类
             * */
            this.optionSwitch = {};
            /*
             * 本地数据开关
             * true 时 用户的ajax请求使用的是本地的模拟数据
             *
             * */
            var locData = false;
            /*
             * ajax请求默认方法（用于开关的转换）
             * */
            var ajaxrequestfn = null;
            Object.defineProperty(this.optionSwitch, 'locData', {
                set: function (a) {
                    //ajax没有加载好时，等待。
                    var ajax = window.ajax || 0;
                    if (!ajax) {
                        var lazytime = setTimeout(function () {
                            clearTimeout(lazytime);
                            this.optionSwitch.locData = a;
                        }, 1500);
                        return;
                    }

                    if (typeof a !== "boolean") return;
                    locData = a;
                    ajaxrequestfn = ajax.request;
                    if (a) {
                        log('本地数据开关开启');
                        //获取ajax修改默认方法
                        ajax.request = function (param, callback) {
                            //准备加载本地数据
                            loadScript('../components/utils/localData.js', function (response) {
                                if (response.status) {
                                    window.setTimeout(function () {
                                        if (window.localdataobj) {
                                            localdataobj.paselocaldata(param, function (data) {
                                                if (data.status) {
                                                    var backdata = data.responseBody;
                                                    //返回数据
                                                    callback({
                                                        status: '000000',
                                                        responseBody: backdata
                                                    });
                                                } else {
                                                    //打印错误信息，执行默认ajax方法
                                                    log(data.message);
                                                    ajaxrequestfn.call(ajax, param, callback);
                                                }
                                            });
                                        }
                                    }, 2000);
                                }
                            });
                        };
                    } else {
                        log('本地数据开关关闭');
                        //如果没有执行过set value=true方法不做处理
                        if (!locData) return;
                        //重新恢复ajax请求
                        ajax.request = function (param, callback) {
                            ajaxrequestfn.call(ajax, param, callback);
                        };
                    }
                },
                get: function () {
                    return locData;
                }
            });
        },
        loadFiles_WuXiaoCode(path, callback, js) {
            var el = document.getElementsByTagName('body')[0];
            var node = document.createElement('script');
            if (js) {
                node.type = 'text/javascript';
                node.src = path;
            } else {
                el = document.getElementsByTagName('head')[0];
                node = document.createElement('link');
                node.rel = 'stylesheet';
                node.type = 'text/css';
                node.href = path;
            }
            //所有浏览器加载css都会走onload方法
            node.onload = function () {
                if (js) {
                    callback({
                        status: true
                    });
                } else {
                    var _n = 0;
                    var _poll = function (node, callback) {
                        var isLoaded = false;
                        if (/webkit/i.test(navigator.userAgent)) {
                            //webkit
                            if (node.sheet) {
                                isLoaded = true;
                            }
                        } else if (node.sheet) {
                            // for Firefox
                            try {
                                if (node.sheet.cssRules) {
                                    isLoaded = true;
                                }
                            } catch (ex) {
                                // NS_ERROR_DOM_SECURITY_ERR
                                if (ex.code === 1000) {
                                    isLoaded = true;
                                }
                            }
                        }
                        if (isLoaded) {
                            callback({
                                status: true
                            });
                        } else {
                            if (++_n > 10) {
                                callback({
                                    status: false,
                                    error: 'CSS文件加载失败，请重试...'
                                });
                            } else {
                                window.setTimeout(function () {
                                    _poll(node, callback);
                                }, 100);
                            }
                        }
                    };

                    _poll(node, callback);
                }
            };
            node.onerror = function (e) {
                callback({
                    status: false,
                    error: (js ? 'script' : 'CSS') + '文件加载时发生错误，请重试...'
                });
            };

            el.appendChild(node);
        },
        getAddress__WuXiaoCode(lat, lang, callback) {
            var _path = window.location.protocol + '//webapi.amap.com/maps?v=1.3&key=585d5dd703232d5bf2311e7b03882824';
            loadScript(_path, function (response) {
                if (response.status) {
                    var n = 0;
                    var t = window.setInterval(function () {
                        n++;
                        if (window.AMap && AMap.service) {
                            window.clearInterval(t);
                            t = null;
                            AMap.service('AMap.Geocoder', function () {
                                //回调函数
                                //实例化Geocoder
                                geocoder = new AMap.Geocoder({
                                    city: "010" //城市，默认：“全国”
                                });
                                //TODO: 使用geocoder 对象完成相关功能
                                var lnglatXY = [lang, lat]; //地图上所标点的坐标
                                geocoder.getAddress(lnglatXY, function (status, result) {
                                    if (status === 'complete' && result.info === 'OK') {
                                        //获得了有效的地址信息:
                                        log('获取具体地理位置成功返回信息：' + result.regeocode.formattedAddress);
                                        if ($.isFunction(callback)) {
                                            callback(result.regeocode.formattedAddress);
                                        }
                                    } else {
                                        //获取地址失败
                                        log('获取具体地理位置失败返回信息：' + JSON.stringify(result));
                                        callback('');
                                    }
                                });
                            });
                        }
                        //如果5s后还未获取成功，则返回空
                        if (n > 10) {
                            window.clearInterval(t);
                            t = null;
                            log('获取具体地理位置失败返回信息：5s后都没有找到AMap.service');
                            callback('');
                        }
                    }, 500);
                } else {
                    common.Prompt(response.error);
                    callback('');
                }
            });
        },
        Map__WuXiaoCode() {
            this.elements = new Array();

            //获取MAP元素个数
            this.size = function () {
                return this.elements.length;
            };

            //判断MAP是否为空
            this.isEmpty = function () {
                return (this.elements.length < 1);
            };

            //删除MAP所有元素
            this.clear = function () {
                this.elements = new Array();
            };

            //向MAP中增加元素（key, value)
            this.put = function (_key, _value) {
                this.elements.push({
                    key: _key,
                    value: _value
                });
            };

            //删除指定KEY的元素，成功返回True，失败返回False
            this.remove = function (_key) {
                var bln = false;
                try {
                    for (i = 0; i < this.elements.length; i++) {
                        if (this.elements[i].key == _key) {
                            this.elements.splice(i, 1);
                            return true;
                        }
                    }
                } catch (e) {
                    bln = false;
                }
                return bln;
            };

            //获取指定KEY的元素值VALUE，失败返回NULL
            this.get = function (_key) {
                try {
                    for (i = 0; i < this.elements.length; i++) {
                        if (this.elements[i].key == _key) {
                            return this.elements[i].value;
                        }
                    }
                } catch (e) {
                    return null;
                }
            };

            //获取指定索引的元素（使用element.key，element.value获取KEY和VALUE），失败返回NULL
            this.element = function (_index) {
                if (_index < 0 || _index >= this.elements.length) {
                    return null;
                }
                return this.elements[_index];
            };

            //判断MAP中是否含有指定KEY的元素
            this.containsKey = function (_key) {
                varbln = false;
                try {
                    for (i = 0; i < this.elements.length; i++) {
                        if (this.elements[i].key == _key) {
                            bln = true;
                        }
                    }
                } catch (e) {
                    bln = false;
                }
                return bln;
            };

            //判断MAP中是否含有指定VALUE的元素
            this.containsValue = function (_value) {
                var bln = false;
                try {
                    for (i = 0; i < this.elements.length; i++) {
                        if (this.elements[i].value == _value) {
                            bln = true;
                        }
                    }
                } catch (e) {
                    bln = false;
                }
                return bln;
            };

            //获取MAP中所有VALUE的数组（ARRAY）
            this.values = function () {
                var arr = new Array();
                for (i = 0; i < this.elements.length; i++) {
                    arr.push(this.elements[i].value);
                }
                return arr;
            };

            //获取MAP中所有KEY的数组（ARRAY）
            this.keys = function () {
                var arr = new Array();
                for (i = 0; i < this.elements.length; i++) {
                    arr.push(this.elements[i].key);
                }
                return arr;
            };
        },

    }
}
</script>

<style>
page {
    background-color: #f4f4fc;
}

.box {
    padding: 0 20rpx;
    box-sizing: border-box;
}

.box uni-button {
    margin: 0;
    background-color: #fff;
    line-height: normal;
    padding: 0;
    position: inherit;
    color: #303133;
    font-size: 14px;
}

.box uni-button:after {
    content: '';
    width: 0;
    height: 0;
}

.list {
    background-color: #fff;
    margin: 20rpx auto;
    padding: 34rpx 20rpx;
    box-sizing: border-box;
    border-radius: 10rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list image {
    width: 45rpx;
    height: 45rpx;
}

.kf-button {
    display: inline;
    background-color: transparent;
    border: none;
    margin: unset;
    padding: unset;
    border-color: transparent;
}
</style>